﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Algorithms
{
    public class AnalyzeCommand
    {
        private IAnalyzeStrategy _analyzer;

        public static AnalyzeCommand GetInstance(IAnalyzeStrategy analyzer)
        {
            AnalyzeCommand aCommand = new AnalyzeCommand(analyzer);
            return aCommand;
        }

        public AnalyzeStrategyResult Execute(AlgorithmInfo algoInfo)
        {
            AlgorithmFactory algoFactory = new AlgorithmFactory();

            IAlgorithm algoSelected = algoFactory.GetAlgorithm(algoInfo);

            AnalyzeStrategyResult aResult = _analyzer.Execute(algoSelected);

            return aResult;
        }

        private AnalyzeCommand(IAnalyzeStrategy analyzer)
        {
            _analyzer = analyzer;
        }
    }
}
